{
  LW Gizmo -- Viewport widgets

  Based on lwgizmo.h which is:
  Copyright 2007, NewTek, Inc.
}

{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}


unit LW_Gizmo;

{$mode objfpc}{$H+}

interface

uses
  LW_CustObj,
  LW_Tool   ,
  LW_Types  ,
  LW_XPanel ;

const
  LWGIZMO_VERSION = 3;

type
  {
    A LightWave viewport tool has the following handler functions.

    Draw     display a wireframe representation of the tool in a 3D
             viewport.  Typically this draws the handles.

    Help     return a text string to be displayed as a help tip for
             this tool.

    Dirty    return flag bit if either the wireframe or help string
             need to be refreshed.

    Count    return the number of handles.  If zero, then 'start' is
             used to set the initial handle point.

    Handle   return the 3D location and priority of handle 'i', or zero
             if the handle is currently invalid.

    Start    take an initial mouse-down position and return the index
             of the handle that should be dragged.

    Adjust   drag the given handle to a new location and return the
             index of the handle that should continue being dragged
             (often the same as the input).

    Down     process a mouse-down event.  If this function returns
             false, handle processing will be done instead of raw
             mouse event processing.

    Move     process a mouse-move event.  This is only called if the
             down function returned true.

    Up       process a mouse-up event.  This is only called if the down
             function returned true.
  }
  PLWGizmoFuncs = ^TLWGizmoFuncs;
  TLWGizmoFuncs = record
    Done   : procedure                                            { UNUSED }
             (      Instance   : PLWInstance       ) ;
  { -------------------------------------------------------------------------- }
    Draw   : procedure
             (      Instance   : PLWInstance       ;
                    DrawAccess : PLWCustomObjAccess) ;
    Help   : function
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ) : PChar    ;
    Dirty  : function
             (      Instance   : PLWInstance       ) : Integer  ;
    Count  : function
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ) : Integer  ;
    Handle : function
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ;
                    I          : Integer           ;
                    Pos        : TLWDVector        ) : Integer  ;
    Start  : function
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ) : Integer  ;
    Adjust : function
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ;
                    I          : Integer           ) : Integer  ;
    Down   : function
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ) : Integer  ;
    Move   : procedure
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ) ;
    Up     : procedure
             (      Instance   : PLWInstance       ;
                    EventInfo  : PLWToolEvent      ) ;
  { -------------------------------------------------------------------------- }
    Event  : procedure                                            { UNUSED }
             (      Instance   : PLWInstance       ;
                    Code       : Integer           ) ;
    Panel  : function                                             { UNUSED }
             (      Instance   : PLWInstance       ) : PLWXPanel;
  end;

  PLWGizmo = ^TLWGizmo;
  TLWGizmo = record
    Instance  : PLWInstance  ;
    Gizmo     : PLWGizmoFuncs;

    PickItems : function
                (      Instance  : PLWInstance;
                 const DrawItems : PPLWItem   ;
                 const Drawparts : PCardinal  ) : PPLWItem;
  end;

implementation

end.

